﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Horridor
{
    class Bullet : InteractiveObject
    {
        int speed = 5;
        Vector2 direction;


        // TODO: WORK WITH ORIGINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11
        //
        //
        //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11114!!!!!!!!!!!!!!!!!!!!!!
        public Bullet(Vector2 origin, Vector2 aim,Texture2D texture)
            : base(texture)
        {
            
            setPos(origin.X, origin.Y);
            
            //this.direction = Vector2.Subtract(new Vector2(aim.X - (drawRectangle.Width / 2), aim.Y - (drawRectangle.Height / 2)), origin);
            this.direction = Vector2.Subtract(aim, origin);
            this.direction.Normalize();
        }

        public new void Update(int ems)
        {
            originPos.X += direction.X * speed;
            originPos.Y += direction.Y * speed;

        }
    }
}
